package com.rc.saas.mini.service.hlhtsk;

import com.rc.saas.mini.mapper.hlhtsk.HlhtskTenantMapper;
import com.rc.saas.mini.model.hlhtsk.HlhtskTenant;
import com.rc.saas.mini.model.hlhtsk.HlhtskTenantExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wangzhengwei
 * @create 2021/12/22
 */
@Service
public class HlhtskTenantServiceImpl implements HlhtskTenantService {

    @Autowired
    private HlhtskTenantMapper hlhtskTenantMapper;

    @Override
    public HlhtskTenantMapper getMapper() {
        return hlhtskTenantMapper;
    }

    @Override
    public HlhtskTenant selectByTenantCode(String tenantCode) {
        HlhtskTenantExample example = new HlhtskTenantExample();
        example.createCriteria().andTenantCodeEqualTo(tenantCode).andStatusEqualTo("0").andTenantHlhtTypeEqualTo("0");
        List<HlhtskTenant> hlhtskTenants= hlhtskTenantMapper.selectByExample(example);
        if (hlhtskTenants!=null &&hlhtskTenants.size()>0){
            return hlhtskTenants.get(0);
        }
        return null;
    }

    @Override
    public List<HlhtskTenant> listByTenantCodeAndTenantHlhtType(String tenantCode, String tenantHlhtType) {
        HlhtskTenantExample example = new HlhtskTenantExample();
        example.createCriteria().andHlhtTenantCodeEqualTo(tenantCode).andTenantHlhtTypeEqualTo(tenantHlhtType).andStatusEqualTo("0");
        List<HlhtskTenant> hlhtskTenants = hlhtskTenantMapper.selectByExample(example);
        return hlhtskTenants;
    }
}
